package com.atguigu.java3;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class IteratorTest {

    @Test
    public void test1() {

        Collection collection = new ArrayList();
        collection.add(1);
        collection.add(2);
        collection.add(3);
        collection.add(4);

        Iterator iterator = collection.iterator();

        while (iterator.hasNext()) {
//            collection.iterator().remove();
            System.out.println(iterator.next());
        }

    }
}
